﻿//////////////////////////////////////////////////////////////////////////
// FileName:fmCarInfoList.aspx
// CreateBy:DragonXiong
// CreateDate:2010-05-27
// Description:
//		  CarInfo List
//      
// Modify Log:
//	
// Copyright:
/////////////////////////////////////////////////////////////////////////
using System;
using System.Data;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Auto.Web.Common;
using Auto.Components;
using Model = Auto.Data.BusMan.Model;
using BLL = Auto.Data.BusMan.BLL;

namespace Auto.BusMan.Report
{
    public partial class CompanyCarSpecHundredOilUsingRpt : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                InitPage();
            }
        }

        private void InitPage()
        {
            this.ucDDLKeepDiv1.InitControl();
            BindData();
        }

        #region Event

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                BindData();
            }
            catch
            {
 
            }
        }

        #endregion Event


        #region --GridView--
        protected void BindData()
        {
            //第一步：设置一个属性（只需要从枚举类型中选取就可以了）
            Chartlet1.AppearanceStyle = FanG.Chartlet.AppearanceStyles.Bar_2D_StarryNight_FlatCrystal_Glow;

            //可选步骤
            //如果你要改变颜色，请取消下面一行的注释，并可以修改参数的值 0 ～ 12 (预置了12种典型颜色)
            //Chartlet1.FillShiftStep = 8;


            string strSql = @"  SELECT bl.BusIdentificationNO
                                              --,b.[CompanyName],bl.BusSpec
                                              ,100*(SUM(b.[OilVolumeByCard])+SUM(b.[OilVolumeByCash]))/MAX(b.[OdometerBus]) AS HundredOilUsing
                                          --INTO A
                                          FROM [Bus_BusOilManage] b
                                          LEFT JOIN Bus_BusList bl ON bl.BusID=b.BusID
                                          LEFT JOIN Bus_Drivers d ON d.DriverID=b.DriverID WHERE 1=1 ";
            if (ucDDLKeepDiv1.SelectedValue!="")
            {
                strSql += " AND b.CompanyID='" + ucDDLKeepDiv1.SelectedValue + "' "; //
            }
            if (txtBusSpec.Text !="")
            {
                strSql += " AND bl.BusSpec LIKE N'%" + txtBusSpec.Text.Trim() + "%'";
            }

            strSql += " GROUP BY bl.BusIdentificationNO,b.CompanyName,bl.BusSpec";

            SqlDataSource1.SelectCommand = strSql;

            

            Chartlet1.ChartTitle = txtBusSpec.Text+ "车型百公里油耗统计";
            //第二步：绑定一个数据源

           Chartlet1.BindChartData(SqlDataSource1);
  

        }

        #endregion --GridView--




    }
}